package org.lex.keytool.core.task;

import org.lex.keytool.core.Args;
import org.lex.keytool.core.Constants;
import org.lex.keytool.core.DName;

public class CreatePublicAndPrivateKeyTask extends CreateTask {
	// key properties
	private String alias = null;
	private String keyPassword = null;
	private String keyAlgorithm = null;
	private String signAlgorithm = null;
	private String keySize = null;
	private String validity = null;
	// store properties
	private String storeType = null;
	private String keyStore = null;
	private String storePassword = null;
	// dname
	private DName dname = new DName();

	public String[] buildArguments() {
		Args args = new Args();
		args.add(Constants.genkeypair);

		args.add(Constants.alias, alias);
		args.add(Constants.keyalg, keyAlgorithm);
		args.add(Constants.keysize, keySize);
		args.add(Constants.sigalg, signAlgorithm);
		args.add(Constants.dname, dname.toString());
		args.add(Constants.keypass, keyPassword);
		args.add(Constants.validity, validity);
		args.add(Constants.storetype, storeType);
		args.add(Constants.keystore, keyStore);
		args.add(Constants.storepass, storePassword);

		args.add(Constants.noprompt);
		return args.build();
	}

	public String getAlias() {
		return alias;
	}

	public void setAlias(String alias) {
		this.alias = alias;
	}

	public String getKeyAlgorithm() {
		return keyAlgorithm;
	}

	public void setKeyAlgorithm(String keyAlgorithm) {
		this.keyAlgorithm = keyAlgorithm;
	}

	public String getKeySize() {
		return keySize;
	}

	public void setKeySize(String keySize) {
		this.keySize = keySize;
	}

	public String getSignAlgorithm() {
		return signAlgorithm;
	}

	public void setSignAlgorithm(String signAlgorithm) {
		this.signAlgorithm = signAlgorithm;
	}

	public DName getDname() {
		return dname;
	}

	public void setDname(DName dname) {
		this.dname = dname;
	}

	public String getKeyPassword() {
		return keyPassword;
	}

	public void setKeyPassword(String keyPassword) {
		this.keyPassword = keyPassword;
	}

	public String getValidity() {
		return validity;
	}

	public void setValidity(String validity) {
		this.validity = validity;
	}

	public String getStoreType() {
		return storeType;
	}

	public void setStoreType(String storeType) {
		this.storeType = storeType;
	}

	public String getKeyStore() {
		return keyStore;
	}

	public void setKeyStore(String keyStore) {
		this.keyStore = keyStore;
	}

	public String getStorePassword() {
		return storePassword;
	}

	public void setStorePassword(String storePassword) {
		this.storePassword = storePassword;
	}
}
